package com.example.administrator.layouttry;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnContextClickListener;
import android.widget.Button;
import android.widget.Toast;

public class LinerLayoutAcitivity extends AppCompatActivity {

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main,menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()){
            case R.id.linerlayout:
                Toast.makeText(this,"You cliked Linerlayout",Toast.LENGTH_SHORT).show();
                Intent toLinerLayout = new Intent(LinerLayoutAcitivity.this,LinerLayoutAcitivity.class);
                startActivity(toLinerLayout);
                break;
            case R.id.Relativelayout:
                Toast.makeText(this,"You clicked Relativelayout",Toast.LENGTH_SHORT).show();
                Intent toRelativeLayout = new Intent(LinerLayoutAcitivity.this,RelativeLayoutActivity.class);
                startActivity(toRelativeLayout);
                break;
            default:
        }
        return true;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.linerlayout);

        Button button1 = (Button)findViewById(R.id.button_1);
        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(LinerLayoutAcitivity.this,RelativeLayoutActivity.class);
                startActivity(intent);
            }
        });


    }




}
